package com.sdx.console.content.service;

import com.ibeetl.admin.core.service.BaseService;
import com.ibeetl.admin.core.util.PlatformException;
import com.sdx.console.content.dao.EbookMainDao;
import com.sdx.console.content.entity.EbookMain;
import org.beetl.sql.core.engine.PageQuery;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

/**
 * 电子书 Service
 */

@Service
@Transactional
public class EbookMainService extends BaseService<EbookMain>{

    @Resource
	private EbookMainDao ebookMainDao;

    public PageQuery<EbookMain>queryByCondition(PageQuery query){
        PageQuery ret =  ebookMainDao.queryByCondition(query);
        queryListAfter(ret.getList());
        return ret;
    }

    public void batchDelEbookMain(List<String> ids){
        try {
            ebookMainDao.batchDelEbookMainByIds(ids);
        } catch (Exception e) {
            throw new PlatformException("批量删除电子书失败", e);
        }
    }

	public List<EbookMain> all() {
		return ebookMainDao.all();
		}
}